﻿<%@ Page Title="" Language="C#" MasterPageFile="~/administrator/backend.Master" AutoEventWireup="true"
    CodeBehind="test-add.aspx.cs" Inherits="VQWEB.administrator.english.tests.test_add" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content_backend" runat="server">
    <form id="frm_test" runat="server" role="form">
    <asp:FormView ID="frmTest" RenderOuterTable="false" runat="server" 
        onitemcreated="frmTest_ItemCreated">
        <EditItemTemplate>
         <div class="form-group">
                <label>
                    Course</label>
             <asp:Literal ID="ltrCourse" runat="server" />
            </div>
            <div class="form-group">
                <label>
                    Tieu de bai thi</label>
                <input class="form-control" name="test_title" type="text" value='<%# Eval("test_title") %>' />
            </div>
            <div class="form-group">
                <label>
                    Noi dung</label>
                <textarea class="form-control" cols="3" name="test_content" rows="3"><%# Eval("test_content")%></textarea>
            </div>
            <div class="form-group">
                <label>
                    Thoi gian thi</label>
                <input class="form-control" name="test_time" type="text" value='<%# Eval("test_time") %>' />
            </div>

             <div class="radio">
                <label>
                    <input type="radio" name="type_code" value="read" <%# Eval("type_code") != null && Eval("type_code").Equals("read") ? " checked='checked'" : null %> />
                    Select Reading
                </label>
            </div>
            <div class="radio">
                <label>
                    <input type="radio" name="type_code" value="listen"  <%# Eval("type_code") != null && Eval("type_code").Equals("listen") ? " checked='checked'" : null %> />
                    Or Select Listening
                </label>
            </div>

            <div class="checkbox">
                <label>
                    <input name="test_active" type="checkbox" <%# Eval("test_active") !=null && (bool)(Eval("test_active")) ? " checked='checked'" : null %> value="True" />
                    Active
                </label>
            </div>
            <input name="test_id" type="hidden" value='<%# (Eval("test_id") != null) ? Eval("test_id") : "0" %>' />
        </EditItemTemplate>
    </asp:FormView>
    </form>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Script_backend" runat="server">
    <script type="text/javascript">
        ShowToolBar("edit");
        var url_ashx = "/admin/english/test/handler";
        $("#btnCancel").live("click", function () {
            window.location = "/admin/english/test/list";
        });
        $("#btnSave").live("click", function () {
            var arr = $("#frm_test").serializeObject();
            $.post(url_ashx, { add_test: window.escape(arr) }, function (data) {
                alert(data);
                window.location = "/admin/english/test/list";
            });
        });
    </script>
</asp:Content>
